package com.ruoyi.ruoyiqywechat.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.qy.vo.VideoInfoVo;
import com.ruoyi.ruoyiqywechat.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("video")
public class VideoController {

    @Autowired
    private VideoService videoService;
    /**
     * （视频号）今日获取对应视频看广告的次数
     * @param videoId 视频ID
     * @return
     */
    @RequestMapping("queryWatchVideoNum")
    public R<Boolean> queryWatchVideoNum(HttpServletRequest request,@RequestParam("videoId")String videoId,@RequestParam("type")String type){
        return R.ok(videoService.queryWatchVideoNum(request,videoId,type));
    }
    /**
     * （视频号）今日累计对应视频看广告的次数
     * @param videoId 视频ID
     * @return
     */
    @RequestMapping("addWatchVideoNum")
    public void addWatchVideoNum(HttpServletRequest request,@RequestParam("videoId")String videoId,@RequestParam("type")String type){
        videoService.addWatchVideoNum(request,videoId,type);
    }
    /**
     * 查询视频列表
     * @param request
     * @param page
     * @param size
     * @return
     */
    @RequestMapping("queryVideoInfoVo")
    public R<HashMap<String,Object>> queryVideoInfoVo(HttpServletRequest request, int page, int size){
        return R.ok(videoService.listVideoInfoVo(request,page,size));
    }
    /**
     * 获取对应视频基本信息
     * @param videoId 视频ID
     * @return
     */
    @RequestMapping("queryVideoInfo")
    public R<HashMap<String,Object>> queryVideoInfo(HttpServletRequest request,@RequestParam("videoId")String videoId){
        return R.ok(videoService.queryVideoInfo(request,videoId));
    }
    /**
     * 获取对应视频文案
     * @param videoId 视频ID
     * @return
     */
    @RequestMapping("queryVideoText")
    public R<HashMap<String,Object>> queryVideoText(HttpServletRequest request,@RequestParam("videoId")String videoId){
        return R.ok(videoService.queryVideoText(request,videoId));
    }
    /**
     * ai生成二条对应视频文案
     * @param videoId 视频ID
     * @return
     */
    @RequestMapping("queryRestVideoText")
    public R<String> queryRestVideoText(HttpServletRequest request,@RequestParam("videoId")String videoId){
        return R.ok(videoService.queryRestVideoText(request,videoId));
    }
    /**
     * ai生成二条对应视频文案（new）
     * @param videoId 视频ID
     * @return
     */
    @RequestMapping("queryRestVideoTextNew")
    public R<List<String>> queryRestVideoTextNew(HttpServletRequest request,@RequestParam("videoId")String videoId){
        return R.ok(videoService.queryRestVideoTextNew(request,videoId));
    }

    /**
     * 绑定视频id
     * @param videoId 视频ID
     * @return
     */
    @GetMapping("bindVideoId")
    public R bindVideoId(HttpServletRequest request,@RequestParam("videoId") String videoId){
        videoService.bindVideoId(request,videoId);
        return R.ok();
    }
}
